#pragma once

#include "mccommonapi.h"
#include "AccessCount.h"

#include <xercesc/dom/DOM.hpp>

namespace MCCommon
{

class XMLElement;
class MCAPI XMLElementIterator
{
public:
    /**
     * Constructor.
     * 
     */
    XMLElementIterator
    (
        xercesc::DOMNodeIterator* iter,
        xercesc::DOMNodeFilter* filter = 0
    );
      
    /**
     * Destructor.
     * 
     */  
    virtual ~XMLElementIterator();

    /**
     * Copy constructor.
     * 
     */
    XMLElementIterator
    (
        const XMLElementIterator& eleIter
    );
        
    /**
     * Assign operator.
     * 
     */
    XMLElementIterator& operator = 
    (
        const XMLElementIterator& eleIter
    );

    /**
     * Is having more elements.
     * 
     */
    bool HasMore();

    /**
     * Get next element.
     * 
     */
    XMLElement Next();

private:
    /**
     * Release all related source.
     * 
     */
    void release();

private:

    // Iterator of DOM node.
    xercesc::DOMNodeIterator* fIter;
    
    // The current node. 
    xercesc::DOMNode* fCurNode;

    // The filter of DOM node.    
    xercesc::DOMNodeFilter* fFilter;

    // Access count.
    AccessCount fAccCount;
}; 

} // end of namespace